{{define "infoCollection/add.html"}}
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>个人筛查信息采集系统</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        {{template "include/styleRefer.html"}}
        <link rel="stylesheet" href="/res/plugins/iCheck/all.css">
        <link rel="stylesheet" href="/res/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
        {{template "include/scriptRefer.html"}}
        <script src="/res/plugins/iCheck/icheck.min.js"></script>
        <script src="/res/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
        <script src="/res/bower_components/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js"
                charset="UTF-8"></script>
        <style>

        </style>
        <script>
            let canUpdate={{.canUpdate}};
        </script>
    </head>
    <body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">
        {{template "mainHeader.html"}}
        {{template "nav.html"}}
        <div class="content-wrapper">
            {{template "contentHeader.html"}}
            <style>
                .shortForm {

                }
            </style>
            <section class="content">

                <div class="box box-info" style="">
                    <div class="box-body">

                        <div class="form-group">
                            <label class="col-sm-1 control-label" style="width: 80px;">姓名:</label>
                            <div id="baseInfo_UserName" class="col-sm-1"
                                 style="color:red;font-weight: bold;padding-left: 0px;width: 80px;"></div>
                            <label class="col-sm-1 control-label" style="width: 100px;">身份证号:</label>
                            <div id="baseUserInfo_IdCard" class="col-sm-2"
                                 style="color:red;font-weight: bold;padding-left: 0px;"></div>
                            <label class="col-sm-1 control-label" style="width: 80px;">性别:</label>
                            <div id="baseUserInfo_Sex" class="col-sm-1"
                                 style="color:red;font-weight: bold;padding-left: 0px;width: 20px;"></div>
                            <label class="col-sm-2 control-label" style="width: 100px;">筛查年份:</label>
                            <div id="baseUserInfo_Year" class="col-sm-1"
                                 style="color:red;font-weight: bold;padding-left: 0px;width: 30px;"></div>

                        </div>
                        <br>
                        <br>
                        <div class="form-group">
                            <label class="col-sm-1 control-label" style="width: 100px;">户籍地址:</label>
                            <div id="baseUserInfo_Address" class="col-sm-4"
                                 style="color:red;font-weight: bold;padding-left: 0px;"></div>
                            <label class="col-sm-1 control-label" style="width: 100px;">风险分级:</label>
                            <div id="baseUserInfo_RiskLevel" class="col-sm-1"
                                 style="color:red;font-weight: bold;padding-left: 0px;width: 50px;"></div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    {{/*<div class="col-md-3"></div>*/}}
                    <div class="col-md-12">
                        <div class="nav-tabs-custom">
                            <ul class="nav nav-tabs">
                                <li id="li_baseInfo" class="active"><a href="#baseInfo" data-toggle="tab">基本信息</a></li>
                                <li id="li_livingStatus"><a href="#livingStatus" data-toggle="tab">生活方式</a></li>
                                <li id="li_family"><a href="#family" data-toggle="tab">家族史</a></li>
                                <li id="li_pastMedicalHistory"><a href="#pastMedicalHistory" data-toggle="tab">既往病史</a>
                                </li>
                                <li id="li_physicalCheckup"><a href="#physicalCheckup" data-toggle="tab">体格检查</a></li>
                                <li id="li_ecg"><a href="#ecg" data-toggle="tab">心电图</a></li>
                                <li id="li_labExamination"><a href="#labExamination" data-toggle="tab">实验室检查</a></li>
                                <li id="li_ccRiskRating"><a href="#ccRiskRating" data-toggle="tab">心脑血管风险评级</a></li>
                                <li id="li_CVUS" style="display: none;"><a href="#CVUS" data-toggle="tab">颈部血管超声</a>
                                </li>
                                <li id="li_inspection" style="display: none;"><a href="#inspection" data-toggle="tab">指导意见</a>
                                </li>
                            </ul>
                            <div class="tab-content">
                                <input type="hidden" id="screenId" value=""/>
                                <div class="active tab-pane" id="baseInfo">
                                    {{template "infoCollection/baseInfo.html"}}
                                </div>

                                <div class="tab-pane" id="livingStatus">
                                    {{template "infoCollection/livingStatus.html"}}
                                </div>

                                <div class="tab-pane" id="family">
                                    {{template "infoCollection/family.html"}}
                                </div>

                                <div class="tab-pane" id="physicalCheckup">
                                    {{template "infoCollection/physicalCheckup.html"}}
                                </div>

                                <div class="tab-pane" id="ecg">
                                    {{template "infoCollection/ecg.html"}}
                                </div>

                                <div class="tab-pane" id="labExamination">
                                    {{template "infoCollection/labExamination.html"}}
                                </div>

                                <div class="tab-pane" id="ccRiskRating">
                                    {{template "infoCollection/ccRiskRating.html"}}
                                </div>

                                <div class="tab-pane" id="pastMedicalHistory">
                                    {{template "infoCollection/pastMedicalHistory.html"}}
                                </div>

                                <div class="tab-pane" id="CVUS">
                                    {{template "infoCollection/CVUS.html"}}
                                </div>
                                <div class="tab-pane" id="inspection">
                                    {{template "infoCollection/inspection.html"}}
                                </div>

                            </div>
                            <!-- /.tab-content -->
                        </div>
                        <!-- /.nav-tabs-custom -->
                    </div>
                </div>
            </section>
        </div>
    </div>
    <script>
        function dateInit(ids) {
            $.each(ids, function (index, id) {
                $('#' + id).datepicker({
                    language: 'zh-CN',
                    autoclose: true,
                    format: 'yyyy-mm-dd'
                });
            });
        }

        $(function () {
                let ids = ["screenDate", "cvusCheckDate", "tigejiancha_yibantizheng_checkDate", "tigejiancha_xueya_measureDate", "tigejiancha_xinzang_checkDate", "ecgExamineDate", "shiyanshi_xuetang_kongfu_checkDate", "shiyanshi_xuetang_canhou_checkDate"
                    , "shiyanshi_xuetang_thxhdb_checkDate", "bloodFatExamineDate", "shiyanshi_hcyExamineDate", "_replyTime"];
                dateInit(ids);
                $('input[type="checkbox"].minimal,input[type="radio"].minimal').iCheck({
                    radioClass: 'iradio_minimal-orange',
                    checkboxClass: 'icheckbox_minimal-orange'
                });
                //----------------------------------------初始化
                let screenOrganCode ={{.screenOrganCode}};
                let area ={{.area}};
                let organs ={{.organs}};
                let screenDate ={{.screenDate}};
                let role ={{.role}};
                if (role == "1" || role == "2") {
                    $("#li_CVUS").show();
                    $("#li_inspection").show();
                }
                $("#area").val(area);
                $("#screenDate").val(screenDate);
                $.each(organs, function (index, val) {
                    let parent = val;
                    let children = val.children;
                    let optionGroup = $("<optgroup label='" + val.organName + "'></optgroup>");
                    $.each(children, function (index2, val2) {
                        let option;
                        if (val2.organCode == screenOrganCode) {
                            option = $("<option value='" + val2.organCode + "' selected>" + val2.organName + "</option>");
                        } else {
                            option = $("<option value='" + val2.organCode + "'>" + val2.organName + "</option>");
                        }
                        optionGroup.append(option);
                    });
                    $("#screenOrganCode").append(optionGroup);
                });
                //----------------------------------------初始化

                //----------------------------------------更新
                let screenId ={{.screenId}};
                let year ={{.year}};
                let currentYear={{.currentYear}}
                $("#screenId").val(screenId);
                if (screenId && screenId != null) {
                    ajaxLoading("正在获取居民档案数据......");
                    let p = {
                        id: screenId
                    };
                    if (year && year != "") {
                        p.year = year;
                        $("#baseUserInfo_Year").text(year);
                    }else{
                        $("#baseUserInfo_Year").text(currentYear);
                    }
                    $.post("/infoCollection/getById", p, function (resp) {
                        ajaxLoadEnd();
                        if (resp.data.baseInfo) {
                            baseInfoInit(resp.data.baseInfo);
                            $("#baseInfo_UserName").text(resp.data.baseInfo.userName);
                            $("#baseUserInfo_IdCard").text(resp.data.baseInfo.idCard);
                            $("#baseUserInfo_Sex").text(resp.data.baseInfo.userSex);
                            $("#baseUserInfo_Address").text(resp.data.baseInfo.address);
                            if (resp.data.ccRiskRating) {
                                $("#baseUserInfo_RiskLevel").text(resp.data.ccRiskRating.risk_level);
                            }
                            if (role == "2") {
                                $("#label_zhuyuanzhenghao").show();
                                $("#div_zhuyuanzhenghao").show();
                            } else {
                                $("#label_zhuyuanzhenghao").hide();
                                $("#div_zhuyuanzhenghao").hide();
                            }
                        }
                        if (resp.data.livingStatus) {
                            livingStatusInit(resp.data.livingStatus);
                        }
                        if (resp.data.family) {
                            familyInit(resp.data.family);
                        }
                        if (resp.data.physicalCheckup) {
                            physicalCheckupInit(resp.data.physicalCheckup);
                        }
                        if (resp.data.ecg) {
                            ecgInit(resp.data.ecg);
                        }
                        if (resp.data.labExamination) {
                            labExaminationInit(resp.data.labExamination);
                        }
                        if (resp.data.ccRiskRating) {
                            ccRiskRatingInit(resp.data.ccRiskRating)
                        }
                        if (resp.data.pastMedicalHistory) {
                            pastMedicalHistoryInit(resp.data.pastMedicalHistory);
                        }
                        if (role != "0" && resp.data.CVUS) {
                            CVUSInit(resp.data.CVUS)
                        }
                    }, 'json');

                }
                //----------------------------------------更新

                loadCurrentTab();

            }
        );

        function loadCurrentTab() {
            let currentTabId = window.localStorage.getItem("currentTab");
            if (currentTabId != null && currentTabId != "") {
                changeTab(currentTabId);
            } else {
                changeTab("baseInfo");
            }
        }
    </script>
    </body>
    </html>
{{end}}